/*************************************************************************
    > File Name: set.cpp
    > Author: cl007
    > Mail: cl007@126.com 
    > Created Time: 2016年10月10日 星期一 15时18分10秒
 ************************************************************************/
#include<set>
#include<string>
#include<iostream>
using namespace std;

int main(int argc, char *argv[])
{   
    set<int>  s1;

    s1.insert(1);

    cout << *(s1.begin()) << endl;
    s1.insert(2);
    s1.insert(3);
    s1.insert(4);

    set<int>::iterator it;

    for(it = s1.begin(); it != s1.end(); it++)
    {
        cout << *it << endl;
    }

    set<int>::reverse_iterator rit;
    for(rit = s1.rbegin(); rit != s1.rend(); rit++)
    {
        cout << *rit << endl;
    }

    cout << s1.count(1) << endl;
    
    it = s1.find(4);

    if(it != s1.end())
    {
        cout << *it << endl;
    }


    cout << s1.size() << endl;

    cout << s1.max_size()<< endl;

    it = s1.upper_bound(2);
    cout << *it << endl;
    it = s1.lower_bound(3);
    cout << *it << endl;

    pair<set<int>::const_iterator, set<int>::const_iterator>  pr;

    pr = s1.equal_range(3);
   
    cout << *pr.first << "   "<< *pr.second << endl;

}
